package com.itc.dispatch.controller;

import com.itc.common.core.domain.R;
import com.itc.common.log.annotation.Log;
import com.itc.common.log.enums.BusinessType;
import com.itc.dispatch.domain.SysCacheData;
import com.itc.dispatch.service.SysCacheDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/cache/data")
@Api(value = "sysCacheData", tags = "用户缓存信息管理")
public class SysCacheDataController {

    @Autowired
    private SysCacheDataService sysCacheDataService;

    /**
     * 用户缓存信息保存
     */
    @ApiOperation(value = "用户缓存信息保存")
    @PostMapping("/save")
    @Log(title = "用户缓存信息保存",businessType = BusinessType.INSERT)
    public R saveCache(@RequestBody SysCacheData dto){
        return sysCacheDataService.saveCache(dto);
    }

    /**
     * 获取当前登录用户缓存信息
     */
    @ApiOperation(value = "获取当前登录用户缓存信息")
    @PostMapping("/get/current")
    public R<SysCacheData> getCurrentCache(@RequestBody SysCacheData dto){
        return sysCacheDataService.getCurrentCache(dto);
    }


}
